Skip to main content
Glama
hyperspell

hyperspell-mcp

Official
by hyperspell

Get Document

Retrieve specific documents from collections to access unstructured or semi-structured data through AI-powered applications.

Instructions

Get a document from a collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
document_idYes

Implementation Reference

  • Handler function that implements the 'Get Document' tool by calling the Hyperspell API to fetch a document by its ID and converting it to a Document object.
    @mcp.tool_or_resource("document://{document_id}", name="Get Document")
    def get_document(document_id: int) -> Document | Error:
        """Get a document from a collection"""
        # try:
        r = mcp.api.documents.get(document_id=document_id)
        return Document.from_pydantic(r)
        # except APIError as e:
        # return Error(error=e.__class__.__name__, message=e.message)
  • Dataclass schema defining the structure of a Document returned by the tool.
    @dataclass
    class Document(BaseModel):
        id: int
        title: str
        type: str
        summary: str
  • Dataclass schema defining the structure of an Error that may be returned by the tool.
    @dataclass
    class Error(BaseModel):
        error: str
        message: str
  • Custom decorator that registers the tool function either as a tool or resource based on config, handling the registration for 'Get Document'.
    def tool_or_resource(self, uri: str, name: str | None = None):
        def decorator(fn: Callable):
            description = fn.__doc__
            if self.config.use_resources:
                self.resource(
                    uri,
                    name=name,
                    description=description,
                    mime_type="application/json",
                )(fn)
            if self.config.use_tools:
                self.add_tool(fn, name=name, description=description)
            return fn
    
        return decorator
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the action ('Get a document') but doesn't disclose behavioral traits such as whether it's a read-only operation, requires authentication, has rate limits, or what happens on errors (e.g., if the document doesn't exist). The description is minimal and lacks essential context for safe and effective use.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It's front-loaded and appropriately sized for a simple tool, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (simple retrieval), lack of annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't explain return values, error handling, or operational context, leaving significant gaps for an AI agent to understand how to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter with 0% description coverage, and the tool description doesn't add any meaning beyond the schema. It mentions 'document_id' indirectly but doesn't explain its format, constraints, or how to obtain it. With low schema coverage, the description fails to compensate, leaving the parameter poorly documented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get a document from a collection' clearly states the action (get) and resource (document), but it's vague about what 'get' entails (e.g., retrieve, fetch, read) and doesn't distinguish it from sibling tools like 'Get Collection' or 'Search Hyperspell'. It's not tautological but lacks specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a document ID), exclusions, or comparisons to siblings like 'Get Collection' (for collections) or 'Search Hyperspell' (for searching). Usage is implied by the name but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hyperspell/hyperspell-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server